'use strict'

import axios from 'axios'
import { Loading } from 'element-ui';

function post(url, data, callback){
	var dataStr = JSON.stringify(data);
	let config = {
		headers: {'Content-Type': 'application/json'}
	};
	// let loadingInstance = Loading.service({ fullscreen: true })
	axios.post(url, dataStr, config)
		.then(function(res){
			//执行回调
			if (callback != undefined) {
				callback(res.data);
			}
			// loadingInstance.close()
		})
		.catch(function(err){
			console.log(err);
			// loadingInstance.close()
		});
}

export default{
	post
}